package com.xbongbong.saas.model;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.paas.toolbox.wrap.UserVO;
import com.xbongbong.saas.domain.entity.WorkOrderFormEntity;
import com.xbongbong.saas.domain.entity.ext.WorkOrderFormEntityExt;

import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
 *
 * @author 魏荣杰
 * @date 2019/3/14 11:09
 * @since v1.0
 * @version v1.0
 */
public interface WorkOrderFormModel extends IModel<WorkOrderFormEntity>{
    @Override
    Integer insert(WorkOrderFormEntity entity) throws XbbException;

    @Override
    Integer update(WorkOrderFormEntity entity) throws XbbException;

    @Override
    List<WorkOrderFormEntity> findEntitys(Map<String, Object> param);

    @Override
    Integer getEntitysCount(Map<String, Object> param);

    List<WorkOrderFormEntityExt> findEntitysExt(Map<String, Object> param);

    Integer deleteByKey(Long key, String corpid);

    WorkOrderFormEntityExt getByKey(Long key, String corpid);

    WorkOrderFormEntityExt getByKeyIncludeDel(Long key, String corpid);

    WorkOrderFormEntityExt getByTemplateId(Long templateId, String corpid);

    /**
     * 批量初始化
     *
     * @author long.rao
     * @date 2019-07-12 14:55
     */
    List<WorkOrderFormEntity> initBatch(List<WorkOrderFormEntity> list, String corpid);
    /**
     * Description: 获取全部列表的默认form数据
     * @return com.xbongbong.saas.domain.entity.WorkOrderFormEntity
     * @author 魏荣杰
     * @date 2019/8/23 16:34
     * @since v4.2.0
     */
    WorkOrderFormEntityExt getDefaultAllListForm();

    List<WorkOrderFormEntityExt> getByIdIn(Collection<Long> idIn, String corpid);

    /**
     * 批量更新关联列表
     * @param formList
     * @param corpid
     * @return
     */
    List<WorkOrderFormEntity> updateBatch(List<WorkOrderFormEntity> formList,String corpid);

    /**
     * 批量插入实体
     * @param list
     * @return 返回数据的列表
     */
    List<WorkOrderFormEntity> insertBatch(List<WorkOrderFormEntity> list);
    /**
     * 批量删除
     * @param list 主键id集合
     * @param corpid
     * @author xingxing.xiao
     */
    Integer deleteBatch(List<Long> list, String corpid);


    /**
     * 获取有权限的工单模板
     * @param corpid
     * @param loginUser
     * @param appId 应用id
     * @param isFree 是否为自由指派工单，0指定流程，1自由流程
     * @return 工单模板
     */
    List<WorkOrderFormEntity> getTemplateWithPermission(String corpid, UserVO loginUser, Long appId, Integer isFree);

}
